import amaret.targets.arm.GCArmv7m;

metaonly module BuildC inherits amaret.freestyle.core.distro.IBaseC {

    readonly config gnu.targets.ITarget.Module GNU_Target;
}

implementation {

    TOOLSDIR := "c:/sourcery";
    
    final Target := GCArmv7m;
    
    Target.platform := 'amaret.platforms.ek_lm3s811';
    Target.rootDir := TOOLSDIR;
    
    Target.profiles['whole_program'] := {};
    Target.profiles['whole_program_debug'] := {};
    
    Target.profiles['whole_program'].filters := [{moduleName: 'biosbob.filters.blas.FilterGCC'}];
    Target.profiles['whole_program_debug'].filters := [{moduleName: 'biosbob.filters.blas.FilterGCC'}];
    
    final GNU_Target := GCArmv7m;
    
    GNU_Target.LONGNAME := "bin/arm-none-eabi-gcc";

    GNU_Target.ccOpts.prefix += " -I " + ^^java.lang.System.getenv('STELLARISWARE')^^;
    GNU_Target.ccOpts.prefix += " -I " + ^^java.lang.System.getenv('STELLARISWARE')^^ + "/boards/ek-lm3s811";

    GNU_Target.ccOpts.prefix += " -ffunction-sections -fdata-sections";
//    GNU_Target.ccOpts.prefix += " -fpack-struct";     // broken!!!

    Build.platformTable[Target.platform] := { toolsDir: TOOLSDIR };
}
